﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;

namespace Codeplex.KinkumaFramework.Utils
{
    public class DesignTimeUtils
    {
        private static bool? isInDesignMode;

        public static bool IsInDesignMode
        {
            get
            {
                if (!isInDesignMode.HasValue)
                {
#if SILVERLIGHT
                    isInDesignMode = DesignerProperties.IsInDesignTool;
#else
                    var prop = DesignerProperties.IsInDesignModeProperty;
                    isInDesignMode = (bool)DependencyPropertyDescriptor
                        .FromProperty(prop, typeof(FrameworkElement))
                        .Metadata.DefaultValue;
#endif
                }

                return isInDesignMode.Value;
            }
        }
    }
}
